import request from "@/utils/request";

// 查询返修任务列表
export function listTask(query) {
  return request({
    url: "/rr/returnrepair/task/list",
    method: "get",
    params: query,
  });
}

// 查询返修任务详细
export function getTask(rrTaskId) {
  return request({
    url: "/rr/returnrepair/task/" + rrTaskId,
    method: "get",
  });
}

// 新增返修任务
export function addTask(data) {
  return request({
    url: "/rr/returnrepair/task",
    method: "post",
    data: data,
  });
}

// 修改返修任务
export function updateTask(data) {
  return request({
    url: "/rr/returnrepair/task",
    method: "put",
    data: data,
  });
}

// 删除返修任务
export function delTask(rrTaskId) {
  return request({
    url: '/rr/returnrepair/task/' + rrTaskId,
    method: 'delete'
  })
}

// 开工
export function start(data) {
  return request({
    url: '/rr/returnrepair/task/start',
    method: 'put',
    data: data
  })
}

// 完工
export function finish(data) {
  return request({
    url: '/rr/returnrepair/task/end',
    method: 'put',
    data: data
  })
}

// 取消
export function cancel(data) {
  return request({
    url: '/rr/returnrepair/task/cancel',
    method: 'put',
    data: data
  })
}

// 获取工单任务详情
export function getTaskInfo(rrTaskId) {
  return request({
    url: '/rr/returnrepair/task/taskInfo/' + rrTaskId,
    method: 'get'
  })
}
